/**
 * 
 */
package research.sbookmarking;

import java.util.*;
import org.connotea.Bookmark;

/**
 * This class is a wrapper for the data mined from Connotea.org. 
 * <P>
 * @author <A HREF="mailto:aatleung@gmail.com">Albert Leung</a>
 * @version 1.0
 */

public abstract class DataContainer {

	// contains the list of bookmarks that was mined from Connotea.org
	private List bookmarks = null;
	
	// contains a list of tags used in the bookmarks mined from Connotea.org
	private List tags = null;

	// contains the frequency of bookmarks in the data mined 
	private HashMap freqBookmarks = null;
	
	// contains the frequency of tags used in the data mined 
	private HashMap freqTags = null;
	
	// contains the list of data from query of Connotea.org
	private List results = null;
	
	/* contains a list of frequency of bookmarks and tags used in the data mined 
	 * from Connotea.org
	 * [0] - bookmarks
	 * [1] - tags
	private List repeats = null;
	 */

/*
	// contains a list of bookmarks for the researchers
	private List researchers = null;
	
	// contains a list of bookmarks for the students
	private List students = null;
*/
	/**
	 * Create a new DataContainer instance using the supplied list of
	 * Bookmark, list of users, list of Tags, distribution of bookmarks
	 * and tags.
	 * <p>
	 * 
	 * @param bmarks the list of unique bookmarks gather from the data mining 
	 * 				 of Connotea.
	 * @param tempTags the list of unique tags gather from the data mining of 
	 * 				   Connotea.
	 * @param freqBook distribution of the bookmarks in the data. 
	 * @param freqTag distribution of the tags in the data.
	 */
	public DataContainer (List bmarks, List tempTags, HashMap freqBook, HashMap freqTag) { 
		setBookmarks (bmarks);
		setTags (tempTags);
		setFreqBookmarks (freqBook);
		setFreqTags (freqTag);
	}
	
	public DataContainer (List results){
		
	}
/*
	public void addBookmarks (List bookmark)
	public void addTags (List aTag)
	public void addFreqBookmarks (Bookmark key, int value)
	public void addFreqTags (Tag key, int value)
	public int getFreqBookmarks (Bookmark key)
	public int getFreqTags (Tag key)
*/ 
	/**
	 * Saves the list of bookmarks that was mined from Connotea.org.
	 * <P>
	 * @param bmarks the list of unique bookmarks gather from the data mining 
	 * 				 of Connotea.
	 */
	protected final void setBookmarks (List bmarks){
		bookmarks=bmarks;
	}
	
	/**
	 * Returns the list of unique bookmarks that was mined from Connotea.org.
	 * <p>
	 * @return a list of unique bookmarks. 
	 */
	public List getBookmarks() {
		return bookmarks;
	}

	/**
	 * Stores the list of tags used in the bookmarks that was mined 
	 * from Connotea.org.
	 * <p>
	 * @param tempTags the list of unique tags gather from the data mining of 
	 * 				   Connotea.
	 */
	protected final void setTags (List tempTags) {
		tags = tempTags;
	}
	
	/**
	 * Returns the list of unique tags used in the bookmarks that was mined 
	 * from Connotea.org.
	 * <p>
	 * @return list of tags used in the bookmarks.
	 */
	public List getTags () {
		return tags;
	}

	/**
	 * Stores the distribution of the bookmarks in a HastMap. 
	 * <p>
	 * @param freqBook distribution of the bookmarks the data mined.
	 */
	protected void setFreqBookmarks(HashMap freqBook){
		freqBookmarks = freqBook;
	}

	/**
	 * Returns the distribution of the bookmarks mined.
	 * <p>
	 * @return a HashMap of the frequency each bookmark mined.
	 */
	public HashMap getFreqBookmarks(){
		return freqBookmarks;
	}
	
	/**
	 * Stores the distribution of the tags in a HastMap. 
	 * <p>
	 * @param freqTag distribution of tags in the data mined.
	 */
	protected void setFreqTags(HashMap freqTag){
		freqTags = freqTag;
	}

	/**
	 * Returns the distribution of the tags mined.
	 * <p>
	 * @return a {@link HashMap HashMap} of the frequency.
	 */
	public HashMap getFreqTags(){
		return freqTags;
	}

	/**
	 * Returns a string representation of the object. The 
	 * toString method returns a string that "textually 
	 * represents" this object.
	 * <p>
	 * @return a string representation of the object.
	 */
	public String toString() {
		Iterator items = getBookmarks().iterator();
		List temp = getBookmarks();
		StringBuffer buffer = new StringBuffer();
		
		while (items.hasNext()) {
			buffer.append(((Bookmark)temp.remove(0)).toString());
		}
		
		return buffer.toString();
	}

	public List getResults() {
		return results;
	}

	private void setResults(List results) {
		this.results = results;
	}

	/*
	 * Create a new DataContainer instance using the supplied list of
	 * Bookmark, list of users, list of Tags, list of bookmarks from
	 * researchers and list of books from students
	 * <p>
	 * @param bmarks
	 * @param uniques
	 * @param tempTags
	 * @param rgroup
	 * @param sgroup
	 */
	/*
	public DataContainer (List bmarks, List uniques, 
						  List tempTags, List rgroup, List sgroup ) {
		setBookmarks (bmarks);
		setUniqueUsers (uniques);
		setTags (tempTags);
		setResearchers (rgroup);
		setStudents (sgroup);
	}
	*/
	
	/*
	public void setUniqueUsers (List uniques){
		uniqueUsers = uniques;
	}
	
	public List getUniqueUsers (){
		return uniqueUsers;
	}
*/
	
	/*
	public void setResearchers (List rgroup) {
		researchers = new ArrayList(rgroup);
	}
	
	public List getResearchers() {
		return researchers;
	}
	
	public void setStudents (List sgroup) {
		students = new ArrayList(sgroup);
	}
	
	public List getStudents () {
		return students;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	*/
}
